﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Data;
using System.Text;
using System.Data;

namespace Presentation
{
    public partial class ConsultaFuncionario : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnExibir_Click(object sender, EventArgs e)
        {
            try
            {
                int idTipo = Convert.ToInt32(ddlTipo.SelectedValue);

                //Abrindo a conexão com o banco
                using (DBUCNEntities banco = new DBUCNEntities())
                {

                    //FORMA 2:
                    //from ALIAS in TABELA
                    //where
                    //select
                    var query = from F in banco.TBFuncionarios
                                where F.IDTipoFuncionario == idTipo
                                select F;


                    grdFuncionarios.DataSource = query;
                    grdFuncionarios.DataBind();
                }
                
            }
            catch (Exception)
            {
                Util.UtilCommom.exibirMensagem(this, "erro");
            }
        }
    }

}